package com.lc.service;

import com.lc.mapper.UserMapper;
import com.lc.pojo.Shop;
import com.lc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    UserMapper userMapper;

    @Override
    public User queryUserByName(String user_phone){
        return userMapper.queryUserByName(user_phone);
    }
    public boolean updateUser(User user){
        int flag = 0;
        try {
            flag = userMapper.updateUser(user);
        } catch (Exception e) {
            return false;
        }
        if (flag == 1) {
            return true;
        } else {
            return false;
        }

    }
    @Override
    public boolean addUser(User user){
        int flag = 0;
        try {
            flag = userMapper.addUser(user);
        } catch (Exception e) {
            return false;
        }
        if (flag == 1) {
            return true;
        } else {
            return false;
        }
    }

}
